using System;
using System.Collections;
using System.Collections.Generic;
using MagicApp.Data.Creature;
using NUnit.Framework;
using MagicApp.Services;
using MagicApp.Data;

namespace MagicApp.Testing
{
	/// <summary>
	/// Description of CardServiceTest.
	/// </summary>
	[TestFixture]
	public class CardServiceTest
	{
		public CardServiceTest()
		{
		}
		[Test]
		public void GetCardById_Should_Return_CardID_of_1()
		{
			ICardService service = new CardService(new DummyCardRepository());
			Card card = service.GetCardById(1);
			Assert.AreEqual(1,card.CardID,"Should have been 1");
		}
		[Test]
		public void GetCardByName_Should_Return_shivan_dragon()
		{
			ICardService service = new CardService(new DummyCardRepository());
			Card card = service.GetCardByName("Card#0");
			Assert.AreEqual("Card#0",card.CardName,"Should be Card#0");
		}
		[Test]
		public void GetCardsBySeries_Should_Return_All_Cards_By_Series_IceAge()
		{
			ICardService service = new CardService(new DummyCardRepository());
			System.Collections.Generic.IList<Card> cards = 
				service.GetCardsForSeries(Series.IceAge);
			foreach(Card card in cards)
			{
				Assert.AreEqual("IceAge",card.Series.ToString(),"should have been an enum returned of urza's saga");
			}
		}
		[Test]
		public void GetCardCount_Should_Return_A_Card_Count_of_10()
		{
			ICardService service = new CardService(new DummyCardRepository());
			Assert.AreEqual(10,service.GetCardsForSeries(Series.IceAge).Count);
		}
        [Test]
        public void GetCardOfType_Should_Return_A_Type_Of_Creature()
        {
            ICardService service = new CardService(new DummyCardRepository());
            System.Collections.Generic.IList <Card> cards =
                service.GetCardsByType(CardType.Creature);
            foreach(Card card in cards)
            {
                Assert.AreEqual("creature", card.CardType.ToString().ToLower(), "type should have been enchantment");
            }
        }
	    [Test]
        public void GetCreatureCards_Should_Return_Cards_Of_Type_Creature()
	    {
	        ICardService service = new CardService(new DummyCardRepository());
	        IList<Card> creatureCards = service.GetCardsByType(CardType.Creature);
	        Assert.IsInstanceOfType(typeof (Creature), creatureCards[0]);
	    }
        [Test]
        public void GetCard_Should_Not_Have_SummoningSickness_Or_Flight()
        {
            ICardService service = new CardService(new DummyCardRepository());
            IList<Card> creatureCards = service.GetCardsByType(CardType.Creature);
            IList<Creature> birds = new List<Creature>();
            foreach(Creature c in creatureCards)
            {
                birds.Add(c);
            }
            Assert.IsFalse(birds[0].HasFlight);
            Assert.IsFalse(birds[0].HasSummoningSickness);
        }
    
    }
}
